package com.xinghou.platform.lucene.main.bean;

import com.xinghou.platform.model.main.Store;
import org.apache.solr.client.solrj.beans.Field;

/**
 * Created by qingshengzheng on 16/4/26.
 */
public class StoreSolr {
    @Field
    public String position;
    @Field
    public Integer id;
    @Field
    public String name;
    @Field
    public String address;
    @Field
    public String level;
    @Field
    public String consume;
    @Field
    public String opentime;
    public String branchstore;
    @Field
    public String telephone;
    @Field
    public String ad_code;
    @Field
    public String category;
    @Field
    public String categorycode;
    @Field
    public String city_code;
    @Field
    public String alias_name;
    @Field
    public Integer  sharecount;

    @Field
    public String ad_code_province;
    @Field
    public String ad_code_region;
    @Field
    public String ad_code_city;
    public static StoreSolr fromStore(Store store) {
        StoreSolr storeSolr = new StoreSolr();
        storeSolr.position = store.getLatitude() + "," + store.getLongitude();
        storeSolr.id = store.getId();
        storeSolr.name = store.getName();
        storeSolr.address = store.getAddress();
        storeSolr.ad_code = store.getAd_code();
        storeSolr.category = store.getCategory();
        storeSolr.categorycode = store.getCategory_code();
        storeSolr.alias_name = store.getAlias_name();
        storeSolr.sharecount=store.getSharecount();

        storeSolr.ad_code=store.getAd_code();
        storeSolr.ad_code_province=store.getAd_code_province();
        storeSolr.ad_code_city=store.getAd_code_city();
        storeSolr.ad_code_region=store.getAd_code_region();
        return storeSolr;

    }
    public  Store toStore()
    {
        Store store=new Store();
        store.setLatitude(Double.parseDouble(position.split(",")[0]));
        store.setLongitude(Double.parseDouble(position.split(",")[1]));
        store.setId(id);
        store.setName(name);
        store.setAddress(address);
        store.setAd_code(ad_code);
        store.setCategory_code(categorycode);
        store.setCategory(category);
        store.setCity_code(city_code);
        store.setAlias_name(alias_name);
        return store;


    }


}
